<template>
    <div class="banner">
        <div class="banner-content">
            <el-carousel height="520px" style="width:calc(100% - 160px);">
                <el-carousel-item v-for="item in carouselData" v-bind:key="item.id">
                    <div class="content-wrap">
                        <img :src="item.image" alt="" srcset="">

                    </div>
                </el-carousel-item>

            </el-carousel>
            <ul class="list">
                <li v-for="item in list" v-bind:key="item.title" :class="{ 'hover': hoverClass == item }"
                    @mouseover="handleMouseOver(item)" @mouseleave="handleMouseOut">
                    <img :src="item.src" alt="" srcset="" class="img_">
                    <p>{{ item.title }}</p>
                </li>
            </ul>
        </div>
    </div>
    <!-- 认证more -->
    <div class="quicknav">
        <div class="itemx">
            <ul>
                <li v-for="item in rz" v-bind:key="item.src">
                   <img :src="item.src" alt="" srcset="">
                </li>
            </ul>
            <div class="advertising">
                <img src="../assets/img/导航图.png" alt="" srcset="">
            </div>
        </div>
    </div>
    <!-- 新闻动态 -->
    <div class="topic">
        <p>新闻动态</p>
        <el-divider class="topic-txt">
            NEWS & EVENTS
        </el-divider>
        <div class="topic-content">
            <div class="news-grid" v-bind:key="item.id" v-for="item in newsData">
                <img :src="item.image" alt="" srcset="">
                <div class="text" @click="router.push('/broadcastItem/' + item.id)">
                    <p v-text="item.name"></p>
                    <p v-text="item.intro">

                    </p>

                </div>
                <p class="time">
                    <el-icon>
                        <Clock />
                    </el-icon>
                    <span v-text="item.pushDate"></span>
                </p>
            </div>

        </div>
        <div class="gd" @click="router.push('/broadcast')">查看更多 >></div>
    </div>
    <!-- 人物 -->
    <div class="td_bg">
        <div class="td_con">
            <dl>
                <dt>
                    <div class="td_bt" style="margin-left: -3px;">
                         <span style="color: red;font-weight: bold;">CWA精英俱乐部</span>
                         <span style="font-size: 20px;">HIGH QUALITY ACTIVITY PLATFORM </span>
                         <p>
                            Welcome more wealth management practitioners, financial analysts,
                            and investors, entrepreneurs to join the CWA Elite Club.
                        </p>
                        <p style="display: flex;
  justify-content: center; /* 水平居中 */
  align-items: center;">精英俱乐部是由各地投融资分析师、财富规划师，以及财富管理与投融资领域从业者、金融分析师和投资人士、企业家等精英自发组成的志愿性组织，旨在创建积极健康专业的社群环境，提供高质量学习、交流、链接的平台。目前俱乐部拥有成员超过三千名，已经在全国二十多个城市组织活动百余起，涉及私享会、项目路演、精品公开课、高峰财富论坛等内容。欢迎感兴趣的朋友加入我们，在这里您可以找到志同道合的小伙伴，与时间共成长。</p>
                    </div>
                </dt>
                <dd>
                    <div class="td_name"> <span>学习型俱乐部<em></em></span>
                        <p class="td_p01">金融从业者, 投资人士, 企业家</p>
                        <p class="td_p01">联系微信iifachina5申请加入</p>

                        <p class="td_p03">了解更多</p>

                    </div>
                    <i><img src="../assets/img/ren2.png" alt="乔治·门茨" title="乔治·门茨"></i>
                </dd>
            </dl>
        </div>
    </div>

    <!-- 优势 -->
    <div class="fw_bg">
        <div class="content">
            <div class="fw_bt fl" data-scroll-reveal="enter left over 1s and move 100px after 0.3s">
                <b>IIFA优势</b> <i>Certification Advantages </i>
            </div>
            <div class="fw_con fr">
                <ul>
                    <li>
                        <i><img src="../assets/img/国际标准.png" alt=" "></i><span>International standard<em> 国际标准</em></span>
                        <div class="sliphover-container">
                            <div class="hhover">
                                <p class="fk_p1">国际标准</p>
                                <p class="fk_p2">投融资与财富管理领域国际标准推行者，在全球60多个国家或地区拥有会员，备受国际知名金融机构的认可。</p>
                            </div>
                        </div>
                    </li>
                    <li>
                        <i><img src="../assets/img/行业权威.png" alt=" "></i><span>Industry Authority<em>行业权威</em></span>
                        <div class="sliphover-container">
                            <div class="hhover">
                                <p class="fk_p1">行业权威</p>
                                <p class="fk_p2">深耕个人、家庭、企业理财行业，拥有该领域最权威的全球知名专家顾问团，拥有行业最权威的职业认证标准。</p>
                            </div>
                        </div>
                    </li>
                    <li>
                        <i><img src="../assets/img/高校认可.png" alt=" "></i><span>University recognition
                            <em>高校认可</em></span>
                        <div class="sliphover-container">
                            <div class="hhover">
                                <p class="fk_p1">高校认可</p>
                                <p class="fk_p2">与全球100多所高等院校和教育机构开展合作与交流，服务涉及实务培训、职业指导、就业推荐、课题研究等。</p>
                            </div>
                        </div>
                    </li>
                    <li class="nobor">
                        <i><img src="../assets/img/终身学习.png" alt=" "></i><span>Lifelong learning
                            <em>终身学习</em></span>
                        <div class="sliphover-container">
                            <div class="hhover">
                                <p class="fk_p1">终身学习</p>
                                <p class="fk_p2">针对会员构建起终身继续教育培养体系，将长期为会员提供具有国际视野的高质量前沿、专业、实务学习内容。</p>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!-- 合作伙伴 -->
    <div class="partner">
        <p>合作伙伴</p>
        <el-divider class="partner-txt">
            DEEP PARTNER
        </el-divider>
        <div class="partner-list">
            <img v-for="item in partnerData" v-bind:key="item.image" :src="item.image" alt="" srcset="" />
        </div>
    </div>
</template>
<script setup lang="ts">
import router from '@/router'
import { getNewsList, getCarouselList, getCooperateList } from '../api/home/news'
import type { NewsModel, CarouselModel } from '../api/home/news';
interface ListItem {
    title: string;
    src: string;
    src2: string;
}
const hoverClass = ref<ListItem | null>(null);

const list = ref<ListItem[]>([
    {
        title: '职场人士',
        src: require('../assets/img/在职人士.png'),
        src2: 'zai_zhi_a.png'
    },
    {
        title: '在校学生',
        src: require('../assets/img/在校学生.png'),
        src2: 'xue_sheng_a.png'
    },
    {
        title: '企业机构',
        src: require('../assets/img/企业机构.png'),
        src2: 'qi_ye_a.png'
    },
    {
        title: '专家顾问',
        src: require('../assets/img/讲师顾问.png'),
        src2: 'jiao_shi_a.png'
    }
])

//const rz = ref(['CAM认证', 'FCO认证', '活动日历', 'AFA认证', 'CWM认证', 'GAFM资质']);

const rz = ref([{src:require('../assets/img/第一行1.png')},{src:require('../assets/img/第一行2.png')},{src:require('../assets/img/第一行3.png')}
,{src:require('../assets/img/第二行1.png')},{src:require('../assets/img/第二行2.png')},{src:require('../assets/img/第二行3.png')}]
)

const handleMouseOver = (item: ListItem) => {
    hoverClass.value = item;
}
const handleMouseOut = () => {
    hoverClass.value = null;
}



const partnerData = ref<CarouselModel[]>([])




const newsData = ref<NewsModel[]>([{ name: '', context: '', pushDate: '', image: '', id: '', intro: '',createTime: '' }])
const carouselData = ref<CarouselModel[]>([{ id: '', image: '', url: '' }])

onMounted(async () => {
    const newRes = await getNewsList({ pageNum: 1, pageSize: 10 })
    if (newRes.code === 200) {
        newsData.value = newRes.data?.records ?? []
    }
    const carouselRes = await getCarouselList()
    if (carouselRes.code === 200) {
        carouselData.value = carouselRes.data ?? []
    }
    const cooperateRes = await getCooperateList()
    if (cooperateRes.code === 200) {
        partnerData.value = cooperateRes.data ?? []
    }

    const websocket = new WebSocket('ws://127.0.0.1:9034/ws');
    websocket.onopen = function (event) {
        console.log(event, 'event')
        console.log('连接成功')
        websocket.send('success')

    }

    websocket.onmessage = function (e) {
        console.log(e.data)
    }



})

</script>
<style scoped lang='less'>
.banner {
    padding: 20px 0;
    background-color: #F7F7F7;

    .banner-content {
        width: 1300px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .content-wrap {
            width: 100%;
            height: 100%;
            background-color: #ffffff;
            position: relative;
            text-align: left;

            img {
                width: 100%;
                height: 100%;
            }

            .content-text {
                position: absolute;
                right: 15px;
                top: 25%;
                z-index: 1;

                p:first-child {
                    font-size: 40px;
                    color: #003768;
                    padding-bottom: 20px;
                }

                p:nth-child(2) {
                    padding-bottom: 5px;
                }

                p:last-child {
                    width: 230px;
                    line-height: 45px;
                    background: #cd6b33;
                    margin-top: 44px;
                    border-radius: 25px;
                    color: #fff;
                    text-align: center;
                }
            }

            // &::after {
            //     content: "";
            //     width: 100%;
            //     height: 100%;
            //     background: url(../assets/img/fline.png) repeat-y center;
            //     position: absolute;
            //     top: 0;
            //     left: 5px;
            // }
        }

        .list {
            li {
                background-color: #003767;
                color: #ffffff;
                list-style: none;
                width: 140px;
                height: 130px;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;

                p {
                    margin-top: 10px;
                }
            }

            li:not(:first-child) {
                border-top: 1px solid #315d85;
            }
        }
    }
}

.gd {
    display: flex;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 10px;
    color: #7C7C7E;
}

.img_ {
    width: 58px;
    height: 49px;
}

.hover {
    background: #0a4d81 !important;
    color: #64b1df !important;
    border-top-color: #003768 !important;
}

.ellipsis {
    width: 100%;
    /* 设定宽度 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: calc(100% - 60px);
    margin-top: 20px;
    font-size: 14px;
}



// 认证
.quicknav {
    display: flex;
    width: 100%;
    margin: 20px auto;
    background: #fff;
    padding: 30px 0;

    .itemx {
        width: 1300px;
        height: 220px;
        margin: 0 auto;
        display: flex;
        flex-direction: row;
        justify-content: space-between;

        ul {
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;
            background-color: #fff;
            width: 1010px;
            justify-content: space-between;

            li {
                display: flex;
                width: 32%;
                height: 100px;
              
                background-size: cover;
                flex-direction: column;
                list-style: none;
                border-radius: 10px;
                align-items: center;
                justify-content: center;


                span {
                    text-shadow: #f1f7f7 1px 0 0, #a4d6e3 0 1px 0, #209393 -1px 0 0, #a9f0fb 0 -1px 0;
                    width: 150px;
                    height: 35px;
                    border-radius: 50px;
                    line-height: 35px;
                    color: #154274;
                    text-decoration: none;
                    font-size: 25px;
                    font-weight: 700;
                    text-align: center;
                }
            }
        }

        .advertising {
            background: url(../assets/img/导航图.png) no-repeat;
            background-size: cover;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 270px;
            border-radius: 10px;

            span {
                // background: #fff;
                height: 70px;
                width: 70px;
                border-radius: 50px;
                line-height: 30px;
                color: #154274;
                text-align: center;
                text-decoration: none;
                padding: 15px 10px 5px 10px;
                /* text-shadow: #f1f7f7 1px 0 0, #a4d6e3 0 1px 0, #209393 -1px 0 0, #a9f0fb 0 -1px 0; */
                font-size: 25px;
                font-weight: 700;
                border: 2px solid #154274;
            }
        }
    }
}

//人物
i {
    color: #fff;
    font-style: normal;
    font-size: 13px;
}

.td_bg {
    margin: 20px auto;
    margin-bottom: 0;

    background: #ffffff;
    border-radius: 10px 10px 0 0;
    padding-top: 50px;

    .td_con {
        display: flex;
        justify-content: space-between;
        width: 1300px;
        margin: 0 auto;
        background: #F7F6F6;
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;

        dl {
            display: flex;
            justify-content: space-between;
            align-content: center;
            flex-direction: row;
            flex-wrap: nowrap;
            align-items: flex-start;
            width: 100%;

            dd {
                display: flex;
                flex-direction: row;
                width: 600px;
                align-content: flex-end;
                align-items: flex-end;
                position: relative;
                justify-content: flex-end;
                height: 370px;
            }

            dt {
                padding: 50px 0 0 50px;
                width: 550px;
             
                .td_bt p {
                    margin-top: 20px;
                    line-height: 25px;
                    font-size: 13px;
                    color: #454545;
                }

                .td_bt span {
                    font-size: 38px;
                    color: #454545;
                    display: block;
                    margin-bottom: 25px;

                    b {
                        color: #f25149;
                        margin-left: 20px;
                    }
                }
            }

            dd i img {
                width: 285px;
            }

            dd .td_name {
                z-index: 2;
                position: absolute;
                left: 50px;
                bottom: 63px;

                .td_p03 {
                    margin: 15px 0 0;
                    width: 230px;
                    height: 46px;
                    line-height: 46px;
                    background: #f25149;
                    text-align: center;
                    font-size: 16px;
                    color: #fff;
                    display: block;
                }

                .td_p01 {
                    font-size: 16px;
                    color: #454545;
                    padding: 10px 0;
                }

                span {
                    display: block;
                    height: 46px;
                    border-bottom: solid 1px #737481;
                    width: 230px;
                    font-size: 24px;

                    em {
                        font-size: 16px;
                        color: #c2c2c2;
                        padding-left: 20px;
                        text-transform: uppercase;
                    }
                }

            }
        }
    }
}

// 优势
.fw_bg {

    background-color: #ffffff;

    margin: 0 auto;
    border-radius: 0 0 10px 10px;
    padding-bottom: 50px;

    .content {
        background: #2b435e;
        height: 155px;
        width: 1300px;
        margin: 0 auto;
        overflow: hidden;

        border-bottom-right-radius: 15px;
        border-bottom-left-radius: 15px;

        .fw_bt {
            width: 260px;
            padding: 25px 0 0;
            margin-left: 50px;

            b {
                display: block;
                font-size: 36px;
                color: #dbe8f7;
            }

            em,
            i {
                color: #fff;
                font-style: normal;
                font-size: 13px;
            }
        }

        .fl {
            float: left;

        }

        .fr {
            float: right;
        }

        .fw_con {
            width: 935px;
            padding: 48px 0 0;
            height: 100px;

            ul {
                display: flex;
                justify-content: space-between;

                li:hover .sliphover-container {
                    display: block;
                }

                li {
                    float: left;
                    padding-right: 20px;
                    position: relative;
                    cursor: pointer;

                    i {
                        display: block;
                        float: left;

                        img {
                            width: 60px;
                            height: 60px;
                        }
                    }

                    span {
                        display: block;
                        float: left;
                        color: #d7d2d2;
                        font-size: 13px;
                        line-height: 12px;
                        // width: 120px;
                        height: 60px;
                        padding: 15px 0 0 16px;

                        em {
                            display: block;
                            font-size: 16px;
                            color: #fff;
                            padding: 10px 0 0;
                            font-style: normal;
                        }
                    }

                    .sliphover-container {
                        position: absolute;
                        margin-top: -48px;
                        height: 155px;
                        line-height: 155px;
                        background-color: #fa534a;
                        color: #fff;
                        overflow: hidden;
                        display: none;
                        text-align: center;
                        z-index: 100;
                        padding: 0 20px;

                        .hhover {
                            line-height: normal;
                            display: flex;
                            height: 100%;
                            align-items: center;
                            flex-direction: column;
                            justify-content: center;
                        }

                        .fk_p1 {
                            font-weight: bold;
                            color: #fff;
                            word-wrap: break-word;
                            word-break: break-all;
                        }

                        .fk_p2 {
                            margin-top: 2px;
                            text-align: center;
                            font-size: 14px;
                            color: #fff;
                        }
                    }
                }
            }

        }
    }
}

// 合作伙伴
.partner {
    width: 100%;
    padding-bottom: 60px;
    height: 630px;
    margin-top: 100px;
    background: #f7f7f7;

    >p:first-child {
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 32px;
        color: #3f4750;
        line-height: 32px;
        width: 100%;
        text-align: center;
        margin-bottom: 30px;
    }

    /deep/.partner-txt {
        width: 35%;
        margin: 0 auto;

        div {
            font-size: 20px;
            color: #467dd0;
            font-weight: 600;
        }
    }

    .partner-list {
        width: 1300px;
        margin: 70px auto;
        display: flex;
        flex-wrap: wrap;
        // justify-content: space-between;
        gap: 50px;

        img {
            width: 220px;
            height: 80px;

            // margin-left: 31px;
        }
    }
}

// 新闻动态
.topic {
    width: 100%;
    padding-bottom: 1px;
    height: fit-content;
    margin-top: 100px;
    overflow: hidden;
    background-color: #F7F7F7;

    >p:first-child {
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 32px;
        color: #3f4750;
        line-height: 32px;
        width: 100%;
        text-align: center;
        margin: 30px 0;
    }

    /deep/.topic-txt {
        width: 35%;
        margin: 0 auto;

        div {
            font-size: 20px;
            color: #467dd0;
            font-weight: 600;
        }
    }

    .topic-content {
        width: 1300px;
        margin: 70px auto;
        display: flex;
        flex-wrap: wrap;
        // justify-content: space-between;
        gap: 20px;

        .news-grid:nth-child(n+5) {
            margin-top: 25px;
        }

        .news-grid {
            width: 310px;
            height: 370px;
            display: flex;
            flex-direction: column;
            background-color: #ffffff;
            border-radius: 8px;

            >img {
                width: 100%;
                height: 150px;
            }

            .text {
                height: calc(100% - 200px);
                padding: 10px;
                color: #7C7C7E;
                margin: 0 0 20px 0;
                cursor: pointer;

                p:first-child {
                    font-size: 16px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    /* white-space: nowrap; */
                    -webkit-line-clamp: 2;
                    height: 50px;
                    -webkit-box-orient: vertical;
                    display: -webkit-box;
                }

                p:last-child {
                    font-size: 14px;
                    margin-top: 15px;
                }
            }

            .time {
                height: 30px;
                color: #7e7c7c;
                padding: 0 10px;

                i {
                    color: #7e7c7c;
                    margin-right: 10px;
                }
            }
        }
    }
}
</style>
